package org.ala.tiktools.rpc.msg.ack;

import java.io.Serializable;
import java.util.Map;

/**
 * @author ala
 * @date 2025-04-04 17:53
 */
public class RpcAckBody implements Serializable {
    public final static long serialVersionUID = 1;


    /**
     *  返回值
     */
    protected Object returnValues;
    /**
     * 	附加数据
     */
    protected Map<String, Object> metadata;
    /**
     *  请求是否成功
     *  <p> true：returnValues不为空  |  false：errorMsg不为空
     */
    protected boolean success;
    /**
     *  请求的异常信息
     *  <p> 完整的异常栈不可能传过来。。。
     */
    protected String errorMsg;


    public static RpcAckBody build() {return new RpcAckBody();}


    public Object getReturnValues() {
        return returnValues;
    }

    public void setReturnValues(Object returnValues) {
        this.returnValues = returnValues;
    }

    public RpcAckBody returnValues(Object returnValues) {
        setReturnValues(returnValues);
        return this;
    }

    public boolean isSuccess() {
        return success;
    }

    public void setSuccess(boolean success) {
        this.success = success;
    }

    public RpcAckBody success(boolean success) {
        setSuccess(success);
        return this;
    }

    public String getErrorMsg() {
        return errorMsg;
    }

    public void setErrorMsg(String errorMsg) {
        this.errorMsg = errorMsg;
    }

    public RpcAckBody errorMsg(String errorMsg) {
        setErrorMsg(errorMsg);
        return this;
    }

	public Map<String, Object> getMetadata() {
		return metadata;
	}

	public void setMetadata(Map<String, Object> metadata) {
		this.metadata = metadata;
	}
	
	public RpcAckBody metadata(Map<String, Object> metadata) {
		setMetadata(metadata);
		return this;
    }
}
